﻿<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0" />
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<meta name="description" content="">

<title>{iMicms:$Dazpan.title}</title>
<link href="{iMicms::STATICS}/guajiang/css/activity-style.css?6778678" rel="stylesheet" type="text/css">
</head>
<body class="activity-lottery-winning" >
<!--main start-->
<div class="main" >
<script src="{iMicms::STATICS}/guajiang/js/jquery.js" type="text/javascript"></script> 
<script src="{iMicms::STATICS}/guajiang/js/alert.js" type="text/javascript"></script> 
<style type="text/css">

.window {
	width:290px;
	position:absolute;
	display:none;
	bottom:30px;
	left:50%;
	 z-index:9999;
	margin:-50px auto 0 -145px;
	padding:2px;
	border-radius:0.6em;
	-webkit-border-radius:0.6em;
	-moz-border-radius:0.6em;
	background-color: #ffffff;
	-webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
	-moz-box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
	-o-box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
	box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
	font:14px/1.5 Microsoft YaHei,Helvitica,Verdana,Arial,san-serif;
}
.window .title {
	
	background-color: #A3A2A1;
	line-height: 26px;
    padding: 5px 5px 5px 10px;
	color:#ffffff;
	font-size:16px;
	border-radius:0.5em 0.5em 0 0;
	-webkit-border-radius:0.5em 0.5em 0 0;
	-moz-border-radius:0.5em 0.5em 0 0;
	background-image: -webkit-gradient(linear, left top, left bottom, from( #585858 ), to( #565656 )); /* Saf4+, Chrome */
	background-image: -webkit-linear-gradient(#585858, #565656); /* Chrome 10+, Saf5.1+ */
	background-image:    -moz-linear-gradient(#585858, #565656); /* FF3.6 */
	background-image:     -ms-linear-gradient(#585858, #565656); /* IE10 */
	background-image:      -o-linear-gradient(#585858, #565656); /* Opera 11.10+ */
	background-image:         linear-gradient(#585858, #565656);
	
}
.window .content {
	/*min-height:100px;*/
	overflow:auto;
	padding:10px;
	background: linear-gradient(#FBFBFB, #EEEEEE) repeat scroll 0 0 #FFF9DF;
    color: #222222;
    text-shadow: 0 1px 0 #FFFFFF;
	border-radius: 0 0 0.6em 0.6em;
	-webkit-border-radius: 0 0 0.6em 0.6em;
	-moz-border-radius: 0 0 0.6em 0.6em;
}
.window #txt {
	min-height:30px;font-size:16px; line-height:22px;
}
.window .txtbtn {
	
	background: #f1f1f1;
	background-image: -webkit-gradient(linear, left top, left bottom, from( #DCDCDC ), to( #f1f1f1 )); /* Saf4+, Chrome */
	background-image: -webkit-linear-gradient( #ffffff , #DCDCDC ); /* Chrome 10+, Saf5.1+ */
	background-image:    -moz-linear-gradient( #ffffff , #DCDCDC ); /* FF3.6 */
	background-image:     -ms-linear-gradient( #ffffff , #DCDCDC ); /* IE10 */
	background-image:      -o-linear-gradient( #ffffff , #DCDCDC ); /* Opera 11.10+ */
	background-image:         linear-gradient( #ffffff , #DCDCDC );
	border: 1px solid #CCCCCC;
	border-bottom: 1px solid #B4B4B4;
	color: #555555;
	font-weight: bold;
	text-shadow: 0 1px 0 #FFFFFF;
	border-radius: 0.6em 0.6em 0.6em 0.6em;
	display: block;
	width: 100%;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
	text-overflow: ellipsis;
	white-space: nowrap;
	cursor: pointer;
	text-align: windowcenter;
	font-weight: bold;
	font-size: 18px;
	padding:6px;
	margin:10px 0 0 0;
}
.window .txtbtn:visited {
	background-image: -webkit-gradient(linear, left top, left bottom, from( #ffffff ), to( #cccccc )); /* Saf4+, Chrome */
	background-image: -webkit-linear-gradient( #ffffff , #cccccc ); /* Chrome 10+, Saf5.1+ */
	background-image:    -moz-linear-gradient( #ffffff , #cccccc ); /* FF3.6 */
	background-image:     -ms-linear-gradient( #ffffff , #cccccc ); /* IE10 */
	background-image:      -o-linear-gradient( #ffffff , #cccccc ); /* Opera 11.10+ */
	background-image:         linear-gradient( #ffffff , #cccccc );
}
.window .txtbtn:hover {
	background-image: -webkit-gradient(linear, left top, left bottom, from( #ffffff ), to( #cccccc )); /* Saf4+, Chrome */
	background-image: -webkit-linear-gradient( #ffffff , #cccccc ); /* Chrome 10+, Saf5.1+ */
	background-image:    -moz-linear-gradient( #ffffff , #cccccc ); /* FF3.6 */
	background-image:     -ms-linear-gradient( #ffffff , #cccccc ); /* IE10 */
	background-image:      -o-linear-gradient( #ffffff , #cccccc ); /* Opera 11.10+ */
	background-image:         linear-gradient( #ffffff , #cccccc );
}
.window .txtbtn:active {
	background-image: -webkit-gradient(linear, left top, left bottom, from( #cccccc ), to( #ffffff )); /* Saf4+, Chrome */
	background-image: -webkit-linear-gradient( #cccccc , #ffffff ); /* Chrome 10+, Saf5.1+ */
	background-image:    -moz-linear-gradient( #cccccc , #ffffff ); /* FF3.6 */
	background-image:     -ms-linear-gradient( #cccccc , #ffffff ); /* IE10 */
	background-image:      -o-linear-gradient( #cccccc , #ffffff ); /* Opera 11.10+ */
	background-image:         linear-gradient( #cccccc , #ffffff );
	border: 1px solid #C9C9C9;
	border-top: 1px solid #B4B4B4;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3) inset;
}

.window .title .close {
	float:right;
	background-image: url("");
	width:26px;
	height:26px;
	display:block;	
}
</style>

<if condition="$Dazpan['end'] eq 1">
    <div class="activity-lottery-end" >
    <div  class="main" >
    <div class="banner"><img src="<php>if(!$Dazpan['endpicurl']){</php>{iMicms::STATICS}/guajiang/images/activity-lottery-end2.jpg<php>}else{</php>{iMicms:$Dazpan.endpicurl}<php>}</php>" /></div>
    <div class="content" style=" margin-top:10px">
        <div class="boxcontent boxyellow">
            <div class="box">
                <div class="title-red">活动结束说明：</div>
                <div class="Detail">
                <p> {iMicms:$Dazpan.endinfo}</p>
                </div>
            </div>
        </div>
    </div>
    </div>
    </div>
<else/>
    <div style="display: none;" class="window" id="windowcenter">
	<div id="title" class="title">消息提醒<span class="close" id="alertclose"></span></div>
	<div class="content">
	 <div id="txt">亲，继续努力哦！</div>
	 <input value="确定" id="windowclosebutton" name="确定" class="txtbtn" type="button">	
	</div>
    </div>
    <?php if ($Dazpan['statdate']<time()){?>
    <div id="outercont"  >
        <div id="outer-cont">
            <div id="outer" style="-webkit-transform: rotate(2075.9993514680145deg);"><img src="{iMicms::STATICS}/guajiang/images/activity-lottery-5.png" width="310px"></div>
        </div>
        <div id="inner-cont">
            <div id="inner" ><img src="{iMicms::STATICS}/guajiang/images/activity-lottery-2.png"></div>
        </div>
    </div>
    <?php  }?>
</if>


<!--content start-->
<div class="content">
    <div class="boxcontent boxyellow"  id="result"  <if condition="$Dazpan['end'] neq 5">style="display:none"</if>>
    <div class="box">
        <div class="title-orange"><span>恭喜您中奖了</span></div>
        <div class="Detail">   
            <p>你中了：<span class="red" id="prizetype" >{iMicms:$Dazpan.prize}等奖</span></p>
            <p>兑奖{iMicms:$Dazpan.renamesn}：<span class="red" id="sncode" >{iMicms:$Dazpan.sn}</span></p>
            <p class="red" id="red">{iMicms:$Dazpan.sttxt}</p>
            <if condition="$record.phone eq ''">
            <p>
            <input name=""  class="px" id="tel" value="" type="text" placeholder="请输入您的{iMicms:$Dazpan.renametel}">
            <input name=""  class="px" id="wechaname" value="" type="text" placeholder="请输入您的微信号">
            <input name=""  id="wechaid" value="{iMicms:$Dazpan.wecha_id}" type="hidden">
            <input name=""  id="lid" value="{iMicms:$Dazpan.lid}" type="hidden">
            <input name=""  id="winprize" value="" type="hidden">
            <input name=""  id="rid" value="{iMicms:$record.id}" type="hidden">
            </p>
            <p>
            <input class="pxbtn" name="提 交"  id="save-btn" type="button" value="用户提交">
            </p>
            <else/>
            {iMicms:$record.phone}
            </if>
            <if condition="$record.sendstutas eq 0">
            <p><input name="" class="px" id="parssword" value="" placeholder="商家输入兑奖密码" type="password"></p>
            <p><input class="pxbtn" name="提 交" id="save-btnn" value="商家提交" type="button"></p>
            <else/>
            <p>已于{iMicms:$record.sendtime|date="Y-m-d",###}兑奖</p>
            </if>
        </div>
    </div>
  </div>


<if condition="$Dazpan['end'] eq 5">
 <div  class="main" style="display:none">
    <div class="content" style=" margin-top:10px">
        <div class="boxcontent boxyellow">
            <div class="box">
                <div class="title-red">恭喜:</div>
                <div class="Detail">
                <p>您已经中了<font color='red'> {iMicms:$Dazpan.prize} </font> ,您的领奖序列号:<font color='red'> {iMicms:$Dazpan.sn} </font>请您牢记及尽快与我们联系</p>
                </div>
            </div>
        </div>
    </div>
    </div>
</if>


<if condition="$Dazpan['On'] eq 1">


			
<div class="boxcontent boxyellow">
    <div class="box">
    <div class="title-green"><span>奖项设置：</span></div>
         <div class="Detail">
         <?php if ($Dazpan['statdate']>time()){echo '<p style="color:red">活动还没有开始 :(</p>';}?>
	<eq name="Dazpan.end" value="5">
	<else/>
		 <eq name="Dazpan.cyfs" value="1"><p>每人最多允许抽奖次数:{iMicms:$Dazpan.canrqnums} <if condition="$Dazpan.daynums neq 0">，每天只能抽{iMicms:$Dazpan.daynums}次</if> <if condition="$Dazpan.usenums gt 0"> - 已抽取 <span class="red" id="usenums">{iMicms:$Dazpan.usenums}</span> 次</if></p>
		 <else/>
        <p>您的剩余积分为:{iMicms:$Dazpan.jf} 参与一次所需积分数为:{iMicms:$Dazpan.decjf} <if condition="$Dazpan.sycs neq 0">，您还可参与{iMicms:$Dazpan.sycs}次</if> <if condition="$Dazpan.usenums gt 0"> - 已抽取 <span class="red" id="usenums">{iMicms:$Dazpan.usenums}</span> 次</if></p>
		 </eq>
      </eq>

            <p>一等奖: {iMicms:$Dazpan.fist}  <php>if($Dazpan['displayjpnums']){</php>奖品数量: {iMicms:$Dazpan.fistnums}<php>}</php></p>
              <if condition="$Dazpan['second'] neq ''">
                <p>二等奖: {iMicms:$Dazpan.second} <php>if($Dazpan['displayjpnums']){</php>奖品数量: {iMicms:$Dazpan.secondnums}<php>}</php></p>
              </if>             
            <if condition="$Dazpan['third'] neq ''">
                <p>三等奖: {iMicms:$Dazpan.third} <php>if($Dazpan['displayjpnums']){</php>奖品数量: {iMicms:$Dazpan.thirdnums}<php>}</php></p>
            </if>
            <if condition="$Dazpan['four'] neq ''">
                <p>四等奖: {iMicms:$Dazpan.four}  <php>if($Dazpan['displayjpnums']){</php>奖品数量: {iMicms:$Dazpan.fournums}<php>}</php></p>
            </if>
            <if condition="$Dazpan['five'] neq ''">
                <p>五等奖: {iMicms:$Dazpan.five}  <php>if($Dazpan['displayjpnums']){</php>奖品数量: {iMicms:$Dazpan.fivenums}<php>}</php></p>
            </if>
            <if condition="$Dazpan['six'] neq ''">
                <p>六等奖: {iMicms:$Dazpan.six}   <php>if($Dazpan['displayjpnums']){</php>奖品数量: {iMicms:$Dazpan.sixnums}<php>}</php></p>
            </if>
        </div>
</div>
</div>
<div class="boxcontent boxyellow">
    <div class="box">
        <div class="title-green">活动说明：</div>
        <div class="Detail">
        <p>{iMicms:$Dazpan.info}</p>
        <p>活动时间:{iMicms:$Dazpan.statdate|date="Y-m-d",###}至{iMicms:$Dazpan.enddate|date="Y-m-d",###}</p>		
        <p><strong>{iMicms:$Dazpan.txt}</strong></p>  
        </div>
    </div>
</div>
</if>

</div>
<!--content end-->
</div>
<!--main end-->
<!--footer start-->
<style>
.footFix{width:100%;text-align:center;position:fixed;left:0;bottom:0;z-index:99;}
#footReturn a, #footReturn2 a {
display: block;
line-height: 41px;
color: #fff;
text-shadow: 1px 1px #282828;
font-size: 14px;
font-weight: bold;
}
#footReturn, #footReturn2 {
z-index: 89;
display: inline-block;
text-align: center;
text-decoration: none;
vertical-align: middle;
cursor: pointer;
width: 100%;
outline: 0 none;
overflow: visible;
Unknown property name.-moz-box-sizing: border-box;
box-sizing: border-box;
padding: 0;
height: 41px;
opacity: .95;
border-top: 1px solid #181818;
box-shadow: inset 0 1px 2px #b6b6b6;
background-color: #515151;
Invalid property value.background-image: -ms-linear-gradient(top,#838383,#202020);
background-image: -webkit-linear-gradient(top,#838383,#202020);
Invalid property value.background-image: -moz-linear-gradient(top,#838383,#202020);
Invalid property value.background-image: -o-linear-gradient(top,#838383,#202020);
background-image: -webkit-gradient(linear,0% 0,0% 100%,from(#838383),to(#202020));
Invalid property value.filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#838383',endColorstr='#202020');
Unknown property name.-ms-filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#838383',endColorstr='#202020');
}

</style>
<div style="height:60px;"></div>
 
<!--footer end-->

<script type="text/javascript">

    
$(function() {
    window.requestAnimFrame = (function() {
        return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame ||
        function(callback) {
            window.setTimeout(callback, 1000 / 60)
        }
    })();

    var totalDeg = 360 * 3 + 0;
    var steps = [];
    var lostDeg = [36, 96, 156, 216, 276,336];
    var prizeDeg = [6, 66, 126,186,246,306];
    var prize, sncode;
    var count = 0;
    var now = 0;
    var a = 0.01;
    var outter, inner, timer, running = false;
    

    function countSteps() {
        var t = Math.sqrt(2 * totalDeg / a);
        var v = a * t;
        for (var i = 0; i < t; i++) {
            steps.push((2 * v * i - a * i * i) / 2)
        }
        steps.push(totalDeg)
    }
     
    function step() {
    	 outter.style.webkitTransform = 'rotate(' + steps[now++] + 'deg)';
        outter.style.MozTransform = 'rotate(' + steps[now++] + 'deg)';
        if (now < steps.length) {
running = true;
            requestAnimFrame(step)
        } else {
            running = false;
            setTimeout(function() {
                if (prize != null) {
                    $("#sncode").text(sncode);
                    var type = "";
                    if (prize == 1) {
                        type = "一等奖"
                    } else if (prize == 2) {
                        type = "二等奖"
                    } else if (prize == 3) {
                    	type = "三等奖"
                    }
                    else if (prize == 4) {
                    	type = "四等奖"
                    }
                    else if (prize == 5) {
                    	type = "五等奖"
                    }
                    else if (prize == 6) {
                    	type = "六等奖"
                    }
                    $("#prizetype").text(type);
                    $("#result").slideToggle(500);
                    $("#outercont").slideUp(500)
                } else {
                	outter.style.webkitTransform = 'rotate(2075.9993514680145deg)';
                   alert("{iMicms:$Dazpan.aginfo}");
				  
                }
            },
            200)
        }
    } //setps()
    
    function start(deg) {
        deg = deg || lostDeg[parseInt(lostDeg.length * Math.random())];
        running = true;
        clearInterval(timer);
        totalDeg = deg;
        steps = [];
        now = 0;
        countSteps();
        requestAnimFrame(step)
    }
    window.start = start;
    outter = document.getElementById('outer');
    inner = document.getElementById('inner');
    i = 10;

<eq name="Dazpan.wecha_id" value="">
$("#windowclosebutton").bind("click",
function() {
 window.location.href="{iMicms:$Dazpan.ydgzurl}";

});
 $("#inner").click(function() { 
alert("请查看活动规则说明");


 }
<else/>
    $("#inner").click(function() { 

        if (running) return;
        if (count >= {iMicms:$Dazpan.canrqnums}) {
        	outter.style.webkitTransform = 'rotate(2075.9993514680145deg)';
            alert("Oh~No~您已经抽了{iMicms:$Dazpan.canrqnums} 次奖,不能再抽了,下次再来吧!");
            return
        }

        if (prize != null) {
        	outter.style.webkitTransform = 'rotate(2075.9993514680145deg)';
            alert("亲，你不能再参加本次活动了喔！下次再来吧^_^");
            return
        }

       $.ajax({
         url     : "/index.php?g=Wap&m=Lottery&a=getajax&token={iMicms:$Dazpan.token}&wecha_id={iMicms:$Dazpan.wecha_id}&oneid={iMicms:$Dazpan.wecha_id}&id={iMicms:$Dazpan.lid}&rid={iMicms:$Dazpan.rid}",
         dataType: "json",
         
         beforeSend : function(){
            running = true;
            timer = setInterval(function() {
                i += 5;
                outter.style.webkitTransform = 'rotate(' + i + 'deg)';
                outter.style.MozTransform = 'rotate(' + i + 'deg)'
            },1)
         },
         success: function(data) {
         	if (data.error == 1) {
         		outter.style.webkitTransform = 'rotate(2075.9993514680145deg)';
         		alert(data.msg);
         		count = {iMicms:$Dazpan.canrqnums};
         		clearInterval(timer);
         		return
         	}
         	if (data.error == "getsn") {

         		$("#tel").val(data.tel);
         		if(data.state==2){
         			$("#closedj").css("display","none");

         		}
         		$("#red").text(data.msg);
         		alert(data.msg + data.sn);
         		count = {iMicms:$Dazpan.canrqnums};
         		clearInterval(timer);
         		prize = data.prizetype;
         		sncode = data.sn;
         		start(prizeDeg[data.prizetype - 1]);
         		return
         	}
         	if (data.success) {
         		prize = data.prizetype;
         		sncode = data.sn;
         		start(prizeDeg[data.prizetype - 1])
         	} else {
         		prize = null;
         		start()
         	}
         	running = false;
         	count++
         },
         error: function() {
         	alert('请求失败，您的网络环境可能不佳!');
         	return;
         	prize = null;
         	start();
         	running = false;
         	count++
         },
         timeout    : 10000       
        
       })//ajax
    }
    </eq>
    ) //#inner click function;
});


$("#windowclosebutton").bind("click",
function() {
location.reload() ;

});
//中奖提交
$("#save-btn").bind("click",
function() {
    var btn = $(this);
    var tel = $("#tel").val();
    var wxname  = $("#wechaname").val();
    var wechaid = $("#wechaid").val();
    var lid     = $("#lid").val();
    var prizetype = $("#winprize").val();
    if (tel == '') {
        alert("请认真输入{iMicms:$Dazpan.renametel}");
        return
    }
    
    if (wxname == '') {
        alert("请认真输入微信号");
        return
    }
   
    var submitData = {
        lid: lid,
        sncode: $("#sncode").text(),
        tel: tel,
        wxname: wxname,
        wechaid:wechaid,
        rid:$("#rid").val(),
        action: "add"
    };
    $.post('index.php?g=Wap&m=Lottery&a=add&token={iMicms:$Dazpan.token}', submitData,
    function(data) {
        if (data.success == true) {
            alert(data.msg);
            $("#result").hide("slow");
            setTimeout("window.location.href = location.href",2000);
            return
        } else {}
    },
    "json")
});

$("#save-btnn").bind("click",
function () {
	var submitData = {
		id: {iMicms:$Dazpan.id},
		rid: {iMicms:$record.id},
		parssword: $("#parssword").val()
	};
	$.post('index.php?g=Wap&m=Lottery&a=exchange&token={iMicms:$Dazpan.token}', submitData,
	function (data) {
		if (data.success == true) {
			alert(data.msg);
			if (data.changed == true) {
				setTimeout("window.location.href = location.href",2000);
			}
			return
		} else {alert(data.msg);}
	},
	"json")
});

</script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script type="text/javascript">
    wx.config({
        debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
        appId: '{iMicms:$signPackage.appId}', // 必填，公众号的唯一标识
        timestamp: "{iMicms:$signPackage.timestamp}", // 必填，生成签名的时间戳
        nonceStr: '{iMicms:$signPackage.nonceStr}', // 必填，生成签名的随机串
        signature: '{iMicms:$signPackage.signature}',// 必填，签名，见附录1
        jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage'] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
    });

    wx.ready(function(){
        wx.error(function(res){
            console.log(res);
        });
        //朋友圈
        wx.onMenuShareTimeline({
            title: "{iMicms:$Dazpan['fxbt']}", // 分享标题
            link: "{iMicms::C('site_url')}{iMicms::U('Wap/Lottery/index',array('token'=>$Dazpan['token'],'id'=>$Dazpan['lid']))}", // 分享链接
            imgUrl: "{iMicms::C('site_url')}/tpl/static/guajiang/images/activity-lottery-5.png", // 分享图标
            success: function () {
                // 用户确认分享后执行的回调函数
            },
            cancel: function () {
                // 用户取消分享后执行的回调函数
            }
        });

        //分享给朋友
        wx.onMenuShareAppMessage({
           title: "{iMicms:$Dazpan['fxbt']}", // 分享标题
            desc: "{iMicms:$Dazpan['fxzy']}", // 分享描述
            link: "{iMicms::C('site_url')}{iMicms::U('Wap/Lottery/index',array('token'=>$Dazpan['token'],'id'=>$Dazpan['lid']))}",  // 分享链接
           imgUrl: "{iMicms::C('site_url')}/tpl/static/guajiang/images/activity-lottery-5.png", // 分享图标
            type: '', // 分享类型,music、video或link，不填默认为link
            dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
            success: function () {
                // 用户确认分享后执行的回调函数
            },
            cancel: function () {
                // 用户取消分享后执行的回调函数
            }
        });
    });
</script>
</body>
</html>